package com.ruoyi.asms.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.asms.domain.AsmsMaintenanceAsset;
import com.ruoyi.asms.mapper.AsmsMaintenanceAssetMapper;
import com.ruoyi.asms.service.IAsmsMaintenanceAssetService;
import com.ruoyi.common.core.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 维护方维护资产信息Service业务层处理
 * 
 * @author yfkj
 * @date 2021-10-21
 */
@Service
public class AsmsMaintenanceAssetServiceImpl extends ServiceImpl<AsmsMaintenanceAssetMapper, AsmsMaintenanceAsset>  implements IAsmsMaintenanceAssetService
{
    @Autowired
    private AsmsMaintenanceAssetMapper asmsMaintenanceAssetMapper;

    /**
     * 查询维护方维护资产信息
     * 
     * @param maintenanceAssetId 维护方维护资产信息主键
     * @return 维护方维护资产信息
     */
    @Override
    public AsmsMaintenanceAsset selectAsmsMaintenanceAssetByMaintenanceAssetId(Long maintenanceAssetId)
    {
        return asmsMaintenanceAssetMapper.selectAsmsMaintenanceAssetByMaintenanceAssetId(maintenanceAssetId);
    }

    /**
     * 查询维护方维护资产信息列表
     * 
     * @param asmsMaintenanceAsset 维护方维护资产信息
     * @return 维护方维护资产信息
     */
    @Override
    public List<AsmsMaintenanceAsset> selectAsmsMaintenanceAssetList(AsmsMaintenanceAsset asmsMaintenanceAsset)
    {
        return asmsMaintenanceAssetMapper.selectAsmsMaintenanceAssetList(asmsMaintenanceAsset);
    }

    /**
     * 新增维护方维护资产信息
     * 
     * @param asmsMaintenanceAsset 维护方维护资产信息
     * @return 结果
     */
    @Override
    public int insertAsmsMaintenanceAsset(AsmsMaintenanceAsset asmsMaintenanceAsset)
    {
        asmsMaintenanceAsset.setCreateTime(System.currentTimeMillis());
        asmsMaintenanceAsset.setCreateBy(SecurityUtils.getUsername());
        return asmsMaintenanceAssetMapper.insertAsmsMaintenanceAsset(asmsMaintenanceAsset);
    }

    /**
     * 修改维护方维护资产信息
     * 
     * @param asmsMaintenanceAsset 维护方维护资产信息
     * @return 结果
     */
    @Override
    public int updateAsmsMaintenanceAsset(AsmsMaintenanceAsset asmsMaintenanceAsset)
    {
        asmsMaintenanceAsset.setUpdateTime(System.currentTimeMillis());
        asmsMaintenanceAsset.setUpdateBy(SecurityUtils.getUsername());

        return asmsMaintenanceAssetMapper.updateAsmsMaintenanceAsset(asmsMaintenanceAsset);
    }

    /**
     * 批量删除维护方维护资产信息
     * 
     * @param maintenanceAssetIds 需要删除的维护方维护资产信息主键
     * @return 结果
     */
    @Override
    public int deleteAsmsMaintenanceAssetByMaintenanceAssetIds(Long[] maintenanceAssetIds)
    {
        return asmsMaintenanceAssetMapper.deleteAsmsMaintenanceAssetByMaintenanceAssetIds(maintenanceAssetIds);
    }

    /**
     * 删除维护方维护资产信息信息
     * 
     * @param maintenanceAssetId 维护方维护资产信息主键
     * @return 结果
     */
    @Override
    public int deleteAsmsMaintenanceAssetByMaintenanceAssetId(Long maintenanceAssetId)
    {
        return asmsMaintenanceAssetMapper.deleteAsmsMaintenanceAssetByMaintenanceAssetId(maintenanceAssetId);
    }
}
